 package server.maps;

 import client.MapleCharacter;
 import client.MapleClient;
 import client.anticheat.CheatingOffense;
 import client.skills.SkillFactory;
 import com.fasterxml.jackson.annotation.JsonCreator;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import constants.SkillConstants;
 import java.awt.Point;
 import server.MapleStatEffect;
 import tools.packet.SummonPacket;


 public final class MapleSummon
   extends AnimatedMapleMapObject
 {
   private final int ownerid;
   private final int skillLevel;
   private final int ownerLevel;
   private final MapleCharacter owner;
   private final long createTime;
   private final SummonMovementType movementType;
   private int skillId;
   private int fh;
   private int duration;
   private MapleMap map;
/*  28 */   private int hp = 1;

   private boolean changedMap = false;

   private int lastSummonTickCount;

   private byte Summon_tickResetCount;

   private long Server_ClientSummonTickDiff;

   private long lastAttackTime;

   private int mobid;

   private int charge;

   private int crystalLevel;
   private int[] state;

   @JsonCreator
   public MapleSummon(@JsonProperty("owner") MapleCharacter owner, @JsonProperty("effect") MapleStatEffect effect, @JsonProperty("pos") Point pos, @JsonProperty("movementType") SummonMovementType movementType, @JsonProperty("duration") int duration, @JsonProperty("mobid") int mobid) {
/*  49 */     this(owner, effect.getSourceid(), effect.getLevel(), pos, movementType, duration, mobid);
   }


   public MapleSummon(MapleCharacter owner, int sourceid, int level, Point pos, SummonMovementType movementType, int duration, int mobid) {
/*  54 */     this.owner = owner;
/*  55 */     this.map = owner.getMap();
/*  56 */     this.ownerid = owner.getId();
/*  57 */     this.ownerLevel = owner.getLevel();
/*  58 */     this.skillId = sourceid;
/*  59 */     this.skillLevel = level;
/*  60 */     this.movementType = movementType;
/*  61 */     setPosition(pos);

/*  63 */     if (!is替身术()) {
/*  64 */       this.lastSummonTickCount = 0;
/*  65 */       this.Summon_tickResetCount = 0;
/*  66 */       this.Server_ClientSummonTickDiff = 0L;
/*  67 */       this.lastAttackTime = 0L;
     }
/*  69 */     this.createTime = System.currentTimeMillis();
/*  70 */     this.duration = duration;
/*  71 */     this.mobid = mobid;
   }







   public void sendSpawnData(MapleClient client) {
/*  81 */     if (client.getPlayer() != null) {
/*  82 */       client.announce(SummonPacket.spawnSummon(this, true));
     }
   }







   public void sendDestroyData(MapleClient client) {
/*  93 */     client.announce(SummonPacket.removeSummon(this, false));
   }






   public void updateMap(MapleMap map) {
/* 102 */     this.map = map;
   }






   public MapleCharacter getOwner() {
/* 111 */     return this.map.getCharacterById(this.ownerid);
   }






   public int getOwnerId() {
/* 120 */     return this.ownerid;
   }






   public int getOwnerLevel() {
/* 129 */     return this.ownerLevel;
   }






   public int getSkillId() {
/* 138 */     return this.skillId;
   }

   public void setSkillId(int skillId) {
/* 142 */     this.skillId = skillId;
   }






   public int getSkillLevel() {
/* 151 */     return this.skillLevel;
   }






   public int getFh() {
/* 160 */     return this.fh;
   }






   public int getSummonHp() {
/* 169 */     return this.hp;
   }






   public void setSummonHp(int hp) {
/* 178 */     this.hp = hp;
   }






   public void addSummonHp(int delta) {
/* 187 */     this.hp += delta;
   }






   public long getCreateTime() {
/* 196 */     return this.createTime;
   }






   public int getDuration() {
/* 205 */     switch (this.skillId) {
       case 400011065:
/* 207 */         return this.duration - 50;
     }
/* 209 */     return this.duration;
   }

   public void setDuration(int duration) {
/* 213 */     this.duration = duration;
   }







   public final void setPosition(Point p) {
/* 223 */     super.setPosition(p);
/* 224 */     MapleFoothold foothold = this.owner.getMap().getFootholds().findBelow(p, true);
/* 225 */     if (foothold == null) {
/* 226 */       this.fh = 0;
     } else {
/* 228 */       this.fh = foothold.getId();
     }
   }






   public boolean is替身术() {
/* 238 */     switch (this.skillId) {
       case 3221014:
       case 4341006:
/* 241 */         return true;
     }
/* 243 */     return is天使召唤兽();
   }

   public boolean is天使召唤兽() {
/* 247 */     return SkillConstants.is天使祝福戒指(this.skillId);
   }





   public boolean isMultiAttack() {
/* 255 */     switch (this.skillId) {
       case 2121005:
       case 2221005:
       case 2321003:
       case 3111005:
       case 3211005:
       case 4111007:
       case 5220023:
       case 5220024:
       case 5220025:
       case 5221022:
       case 5321052:
       case 5711001:
       case 22171081:
       case 23111008:
       case 23111009:
       case 23111010:
       case 32001014:
       case 32100010:
       case 32110017:
       case 32120019:
       case 33001007:
       case 33001008:
       case 33001009:
       case 33001010:
       case 33001011:
       case 33001012:
       case 33001013:
       case 33001014:
       case 33001015:
       case 35101012:
       case 35111002:
       case 35121003:
       case 36121002:
       case 36121013:
       case 112001007:
       case 112101016:
       case 400011005:
       case 400011057:
       case 400021017:
       case 400021032:
       case 400021054:
       case 400031007:
       case 400031008:
       case 400031009:
/* 300 */         return true;
     }
/* 302 */     return false;
   }






   public boolean showCharLook() {
/* 311 */     switch (this.skillId) {
       case 400011005:
       case 400031007:
       case 400031008:
       case 400031009:
       case 400041028:
/* 317 */         return true;
     }
/* 319 */     return (is傀儡召唤() || is影子侍从() || is粉红影子());
   }


   public boolean is神箭幻影() {
/* 324 */     return (this.skillId == 3221014);
   }

   public boolean is灵魂助力() {
/* 328 */     return (this.skillId == 1301013);
   }

   public boolean is傀儡召唤() {
/* 332 */     return (this.skillId == 4341006);
   }

   public boolean is影子侍从() {
/* 336 */     return (this.skillId == 14111024 || this.skillId == 14121054 || this.skillId == 14121055 || this.skillId == 14121056);
   }

   public boolean is粉红影子() {
/* 340 */     return (this.skillId == 131002017 || this.skillId == 131003017);
   }

   public boolean is机械磁场() {
/* 344 */     return (this.skillId == 35111002);
   }

   public boolean is大漩涡() {
/* 348 */     return (this.skillId == 12111022);
   }

   public boolean is黑暗杂耍() {
/* 352 */     return (this.skillId == 4111007 || this.skillId == 4211007);
   }

   public boolean isMultiSummon() {
/* 356 */     return (this.skillId == 5211014);
   }

   public boolean isSummon() {
/* 360 */     return (is天使召唤兽() || SkillFactory.getSkill(this.skillId).isSummonSkill());
   }




   public SummonMovementType getMovementType() {
/* 367 */     return this.movementType;
   }




   public byte getAttackType() {
/* 374 */     if (is天使召唤兽()) {
/* 375 */       return 2;
     }
/* 377 */     switch (this.skillId) {
       case 4341006:
       case 12000022:
       case 12100026:
       case 12110024:
       case 12120007:
       case 12120013:
       case 12120014:
       case 13111024:
       case 13120007:
       case 14000027:
       case 14001027:
       case 14111024:
       case 14121055:
       case 14121056:
       case 35111002:
       case 35111005:
       case 35121010:
       case 400031007:
       case 400031008:
       case 400031009:
       case 400041028:
/* 399 */         return 0;

       case 3221014:
       case 4111007:
       case 4211007:
       case 12111022:
       case 22171081:
       case 35101012:
       case 36121013:
       case 42001100:
       case 42100000:
       case 42110000:
       case 42111003:
       case 42111101:
       case 42111102:
       case 42120001:
       case 112001007:
       case 112101016:
       case 151100002:
       case 151111001:
       case 164121008:
       case 400001013:
       case 400001016:
       case 400011001:
       case 400011005:
       case 400011057:
       case 400011088:
       case 400011090:
       case 400021054:
       case 400021067:
       case 400021069:
       case 400041050:
       case 400051023:
/* 432 */         return 1;
       case 1301013:
       case 36121014:
/* 435 */         return 2;
       case 23111008:
       case 23111009:
       case 23111010:
       case 35111001:
       case 35111009:
       case 35111010:
       case 36121002:
/* 443 */         return 3;
       case 164111007:
/* 445 */         return 5;
       case 32001014:
       case 32100010:
       case 32110017:
       case 32120019:
       case 35121009:
       case 400011006:
       case 400051022:
/* 453 */         return 6;
       case 14111010:
       case 35121003:
       case 400011077:
       case 400011078:
/* 458 */         return 7;
       case 5201012:
       case 5201013:
       case 5201014:
       case 5210015:
       case 5210016:
       case 5210017:
       case 5210018:
/* 466 */         return 10;
       case 33001007:
       case 33001008:
       case 33001009:
       case 33001010:
       case 33001011:
       case 33001012:
       case 33001013:
       case 33001014:
       case 33001015:
/* 476 */         return 11;
       case 5221022:
       case 42100010:
/* 479 */         return 12;
       case 400041038:
/* 481 */         return 13;
       case 400011012:
       case 400011013:
       case 400011014:
/* 485 */         return 14;
       case 400051009:
       case 400051017:
/* 488 */         return 15;
       case 400021047:
/* 490 */         return 15;
       case 400021071:
       case 400041044:
       case 400051038:
       case 400051046:
       case 400051052:
       case 400051053:
/* 497 */         return 17;
       case 400051028:
       case 400051029:
       case 400051030:
       case 400051031:
       case 400051032:
/* 503 */         return 19;
     }
/* 505 */     return 1;
   }




   public byte getRemoveStatus() {
/* 512 */     if (is天使召唤兽()) {
/* 513 */       return 10;
     }
/* 515 */     switch (this.skillId) {
       case 5321003:
       case 33101008:
       case 35111002:
       case 35111005:
       case 35111008:
       case 35111011:
       case 35121009:
       case 35121010:
       case 35121011:
       case 42100010:
       case 42101001:
       case 400011065:
       case 400051014:
/* 529 */         return 5;
       case 23111008:
       case 23111009:
       case 23111010:
       case 35111001:
       case 35111009:
       case 35111010:
       case 35121003:
       case 400051017:
/* 538 */         return 10;
     }
/* 540 */     return 0;
   }


   public MapleMapObjectType getType() {
/* 545 */     return MapleMapObjectType.SUMMON;
   }

   public void CheckSummonAttackFrequency(MapleCharacter chr, int tickcount) {
/* 549 */     int tickdifference = tickcount - this.lastSummonTickCount;
/* 550 */     if (tickdifference < (SkillFactory.getSummonData(this.skillId)).delay) {
/* 551 */       chr.getCheatTracker().registerOffense(CheatingOffense.FAST_SUMMON_ATTACK);
     }
/* 553 */     long STime_TC = System.currentTimeMillis() - tickcount;
/* 554 */     long S_C_Difference = this.Server_ClientSummonTickDiff - STime_TC;
/* 555 */     if (S_C_Difference > 500L) {
/* 556 */       chr.getCheatTracker().registerOffense(CheatingOffense.FAST_SUMMON_ATTACK);
     }
/* 558 */     this.Summon_tickResetCount = (byte)(this.Summon_tickResetCount + 1);
/* 559 */     if (this.Summon_tickResetCount > 4) {
/* 560 */       this.Summon_tickResetCount = 0;
/* 561 */       this.Server_ClientSummonTickDiff = STime_TC;
     }
/* 563 */     this.lastSummonTickCount = tickcount;
   }

   public void CheckPVPSummonAttackFrequency(MapleCharacter chr) {
/* 567 */     long tickdifference = System.currentTimeMillis() - this.lastAttackTime;
/* 568 */     if (tickdifference < (SkillFactory.getSummonData(this.skillId)).delay) {
/* 569 */       chr.getCheatTracker().registerOffense(CheatingOffense.FAST_SUMMON_ATTACK);
     }
/* 571 */     this.lastAttackTime = System.currentTimeMillis();
   }

   public boolean checkLastAttackTime() {
/* 575 */     if (System.currentTimeMillis() - (getSkillCoolTime(this.skillId) * 1000) < this.lastAttackTime) {
/* 576 */       return false;
     }
/* 578 */     this.lastAttackTime = System.currentTimeMillis();
/* 579 */     return true;
   }






   public boolean isChangedMap() {
/* 588 */     return this.changedMap;
   }






   public void setChangedMap(boolean cm) {
/* 597 */     this.changedMap = cm;
   }






   public boolean isChangeMapCanceled() {
/* 606 */     return (getMovementType() == SummonMovementType.不会移动 || getMovementType() == SummonMovementType.CIRCLE_STATIONARY || getMovementType() == SummonMovementType.自由移动);
   }

   public int getMobid() {
/* 610 */     return this.mobid;
   }

   public void setMobid(int mobid) {
/* 614 */     this.mobid = mobid;
   }

   public int getSkillCoolTime(int skillId) {
/* 618 */     switch (skillId) {
       case 32001014:
/* 620 */         return 9;
       case 32100010:
       case 400011006:
/* 623 */         return 8;
       case 32110017:
/* 625 */         return 6;
       case 32120019:
/* 627 */         return 5;
       case 400011077:
/* 629 */         return 3;
       case 400011078:
/* 631 */         return 5;
     }
/* 633 */     return 0;
   }

   public final boolean isSimpleAttack() {
/* 637 */     switch (this.skillId) {
       case 2111010:
       case 35121011:
       case 42100010:
       case 400011029:
       case 400011065:
       case 400051023:
/* 644 */         return false;
     }

/* 647 */     return true;
   }



   public boolean isMutipleSummon() {
/* 653 */     switch (this.skillId) {
       case 2111010:
       case 14000027:
       case 32111006:
       case 33101008:
       case 35111002:
       case 400021047:
/* 660 */         return true;
     }

/* 663 */     return false;
   }





   public long getSumSurplusTime() {
/* 671 */     return System.currentTimeMillis() - this.createTime;
   }

   public int getCharge() {
/* 675 */     return this.charge;
   }

   public void setCharge(int charge) {
/* 679 */     this.charge = charge;
   }

   public int getCrystalLevel() {
/* 683 */     return this.crystalLevel;
   }

   public void setCrystalLevel(int crystalLevel) {
/* 687 */     this.crystalLevel = crystalLevel;
   }

   public int getState(int index) {
/* 691 */     return this.state[index];
   }

   public void setState(int index, int value) {
/* 695 */     this.state[index] = 0;
   }
 }


/* Location:              C:\PGX\Server.jar!\server\maps\MapleSummon.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */